import request from '@/utils/request'

/* ----- 《组织机构管理》页面 ------*/
// 根据父节点orgCode，查询下面的子结点
export function getorganization(data) {
  return request({
    // url: '/api/uf/pro/resource/organizationbasic/OrganizationBasicRest/searchTree/v1',
    url: '/api/uf/pro/resource/organizationbasic/OrganizationBasicRest/searchTree/v1',
    method: 'post',
    data
  })
}

// 根据orgCode，查询组织机构路径,例如，传入'YF'，返回['UF','YF']
/* <!--add by ljx--><!--2021/12/27-->*/
export function getOrgPathByCode(data) {
  return request({
    url: '/api/uf/pro/resource/organizationbasic/OrganizationBasicRest/searchParentCode/v1',
    method: 'post',
    data
  })
}

export function addorganization(data) {
  return request({
    // url: '/api/uf/pro/resource/organizationbasic/OrganizationBasicRest/save/v1',
    url: '/api/uf/pro/resource/organizationbasic/OrganizationBasicRest/save/v1',
    method: 'post',
    data
  })
}

export function deleteorganization(data) {
  return request({
    headers: {
      'Content-Type': 'application/json'
    },
    // url: '/api/uf/pro/resource/organizationbasic/OrganizationBasicRest/deleteById/v1',
    url: '/api/uf/pro/resource/organizationbasic/OrganizationBasicRest/deleteById/v1',
    method: 'post',
    data: data
  })
}
